package tdd.refactor;

public class ExtraFee implements Chargeable {
	protected TaxiFeeModel taxiFeeModel;
	protected double pricePerMileSec;
	protected double pricePerMile;
	protected double secondMiles;

	/**
	 * @param taxiFeeModel
	 */
	public ExtraFee(TaxiFeeModel taxiFeeModel) {
		super();
		this.taxiFeeModel = taxiFeeModel;
	}

	public ExtraFee(TaxiFeeModelExtra modelEx) {
		this.pricePerMileSec = modelEx.pricePerMileSec;
		this.pricePerMile = modelEx.pricePerMile;
		this.secondMiles = modelEx.secondMiles;	
		}

	public double chargeByMiles(double miles) {
		return  Math.ceil(miles) > this.secondMiles ? 
		(Math.ceil(miles) - this.secondMiles) * (this.pricePerMileSec - this.pricePerMile) : 0;
	}
}
